from django.conf import settings
import requests


def common_msg(mobile, content):
    '''发送普通短信'''
    account = settings.SMS_ACCOUNT
    password = settings.SMS_PASSWORD
    extno = settings.SMS_EXTNO
    send_url = 'http://114.55.166.218:7862/sms?action=send&account={account}&password={password}&mobile={mobile}&content={content}&extno={extno}&rt=json'
    url = send_url.format(account=account, password=password,
                          mobile=mobile, content=content, extno=extno)
    res = requests.get(url)
    return res.json()


def common_msg1(mobile, content):
    '''发送普通短信'''
    account = '888078'
    password = 'M6YHWe'
    extno = '10699999470'
    send_url = 'CMPP://114.55.166.218:7862/sms?action=send&account={account}&password={password}&mobile={mobile}&content={content}&extno={extno}&rt=json'
    url = send_url.format(account=account, password=password,
                          mobile=mobile, content=content, extno=extno)
    res = requests.get(url)
    return res.json()